% function to average transfer functions 
% over a parzen window 
% Ref: ProcMT manual
% made to average tipper impedances
% latest date 18.10.2002

function[tf] = AvTrfn(tf1,TLine,TRad),

k = length(TLine);
for i = 1:k,
par = parzen(TRad(i));
CPLX = 0;
if TLine(i) > 1,
if TRad(i) > 1,
	%----- parzening line 2 to radius -----------
     for l = 1:TRad(i)-1,
	CPLX = CPLX + tf1(TLine(i)-l)*par(l+1);
	CPLX = CPLX + tf1(TLine(i)+l)*par(l+1);
end;
	%----- parzening line 1 -----------
CPLX = CPLX + tf1(TLine(i))*par(1);
else,
CPLX = tf1(TLine(i));
end;
tf(i) = CPLX;
else,
   tf(i) = 0;
end;

end;
